package com.soloyogame.anitoys.db.dao.impl;

import com.soloyogame.anitoys.db.BaseDao;
import com.soloyogame.anitoys.db.commond.Orderdetail;
import com.soloyogame.anitoys.db.commond.Orderpay;
import com.soloyogame.anitoys.db.commond.ReportInfo;
import com.soloyogame.anitoys.db.dao.OrderpayDao;
import com.soloyogame.anitoys.db.page.PagerModel;

import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

import java.util.List;

@Repository("orderpayDaoManage")
public class OrderpayDaoImpl implements OrderpayDao {

    @Resource
    private BaseDao dao;

    @Override
    public List<ReportInfo> reportProductSales(Orderdetail orderdetail) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
	public boolean isOrderpayCreate(String orderId) {
		int a = dao.getCount("front.orderpay.isOrderpayCreate", orderId);
		if(a>0){
			return true;
		}else{
			return false;
		}
	}

    public PagerModel selectPageList(Orderpay e) {
        return dao.selectPageList("manage.orderpay.selectPageList",
                "manage.orderpay.selectPageCount", e);
    }

    public List selectList(Orderpay e) {
        return dao.selectList("manage.orderpay.selectList", e);
    }

    public Orderpay selectOne(Orderpay e) {
        return (Orderpay) dao.selectOne("manage.orderpay.selectOne", e);
    }

    public int delete(Orderpay e) {
        return dao.delete("manage.orderpay.delete", e);
    }

    public int update(Orderpay e) {
        return dao.update("manage.orderpay.update", e);
    }

    public int deletes(String[] ids) {
        Orderpay e = new Orderpay();
        for (int i = 0; i < ids.length; i++) {
            e.setId(ids[i]);
            delete(e);
        }
        return 0;
    }

    public int insert(Orderpay e) {
        return dao.insert("manage.orderpay.insert", e);
    }

    public int deleteById(int id) {
        return dao.delete("manage.orderpay.deleteById", id);
    }

    @Override
    public Orderpay selectById(String id) {
        return null;
    }
    
    /**
     * 前端更新支付信息
     */
    public int updateFront(Orderpay e) {
		return dao.update("front.orderpay.update", e);
	}
    
    /**
     * 前段插入支付信息
     * @param e
     * @return
     */
    public int insertFront(Orderpay e) {
		return dao.insert("front.orderpay.insert", e);
	}

}
